# 访问网页的模块
import requests
# 正则表达式的模块
import re
url = "http://www.weather.com.cn/weather1d/101010100.shtml"
# 打开浏览器并打开网址
resp = requests.get(url)
# 设置编码格式
resp.encoding = "utf-8"
city = re.findall('<span class="name">([\u4e00-\u9fa5]*)</span>', resp.text, re.I)
weather = re.findall('<span class="weather">([\u4e00-\u9fa5]*)</span>', resp.text, re.I)
wd = re.findall('<span class="wd">(.*)</span>', resp.text, re.I)
zs = re.findall('<span class="zs">([\u4e00-\u9fa5]*)</span>', resp.text, re.I)
# 数据打包
lst = []
for a, b, c, d in zip(city, weather, wd, zs):
    lst.append([a, b, c, d])
for item in lst:
    print(item)

